## Display the table ----htmltools::tagList(DT::datatable(fish_traits))
traits correlation
Code
M <-cor(numeric_traits[, c(-1)])ggcorrplot::ggcorrplot(M, hc.order =TRUE, type ="lower",lab =TRUE, tl.cex =9, lab_size =3)
Code
ggsave("corrplot.png", path ="figures")
Code
# list of species sp_names <-c(rownames(fish_traits), "Nannobrachium_atrum", "Cyclothone", "Stomias_boa_boa")# taxonomic_familiestaxonomic_families <- sp_names %>%as.data.frame() %>%`colnames<-`("species") %>%mutate(family =case_when( species %in%c("Benthosema_glaciale","Ceratoscopelus_maderensis","Diaphus_metopoclampus","Lampanyctus_ater","Lampanyctus_crocodilus","Lampanyctus_macdonaldi","Lobianchia_gemellarii","Myctophum_punctatum","Notoscopelus_bolini","Notoscopelus_kroyeri","Bolinichthys_supralateralis" ) ~"Myctophidae", species %in%c("Borostomias_antarcticus","Chauliodus_sloani","Malacosteus_niger","Melanostomias_bartonbeani","Stomias_boa" ) ~"Stomiidae", species %in%c("Holtbyrnia_anomala","Holtbyrnia_macrops","Maulisia_argipalla","Maulisia_mauli","Maulisia_microlepis","Normichthys_operosus","Searsia_koefoedi","Sagamichthys_schnakenbecki" ) ~"Platytroctidae", species %in%c("Sigmops_bathyphilus","Gonostoma_elongatum") ~"Gonostomatidae", species %in%c("Argyropelecus_hemigymnus","Maurolicus_muelleri","Argyropelecus_olfersii" ) ~"Sternoptychidae", species =="Anoplogaster_cornuta"~"Anoplogastridae", species %in%c("Arctozenus_risso", "Paralepis_coregonoides") ~"Paralepididae", species =="Bathylagus_euryops"~"Bathylagidae", species =="Cyclothone_sp"~"Gonostomatidae", species =="Derichthys_serpentinus"~"Derichthyidae", species =="Eurypharynx_pelecanoides"~"Eurypharyngidae", species =="Evermannella_balbo"~"Evermannellidae", species =="Lestidiops_sphyrenoides"~"Lestidiidae", species =="Melanostigma_atlanticum"~"Zoarcidae", species %in%c("Photostylus_pycnopterus","Xenodermichthys_copei") ~"Alepocephalidae", species =="Serrivomer_beanii"~"Serrivomeridae" ) )
The first column contains traits name. The second column contains traits type following this code:
N: nominal trait (factor variable)
O: ordinal traits (ordered variable)
Q: quantitative traits (numeric values)
1/3 of the traits are nominal (traits related to teeth and photophores), need to give them different weights so as not to overestimate functional diversity?
Community Weighted Mean : somme de l’abondance relative d’une espèce x valeur du trait
trait quantittatif : valeur moyenne du trait si on prend un individu au hasard dans l’assemblage
trait catégoriel : proportion des espèces possédant ce trait, une valeur élevée peut indiquer soit qu’un grand nombre possèdent se trait ou que l’espèce avec la plus forte abondance relative possède ce trait
données centrées-réduites
Code
# spxtraits.matrix ----spxcom.matrix <- depth_fish_biomass %>%t() %>%as.data.frame() %>%relocate("Epipelagic", "Upper mesopelagic", "Lower mesopelagic","Bathypelagic" ) %>% tibble::rownames_to_column("species") %>%arrange(species) %>% tibble::column_to_rownames("species") %>%as.matrix()library(dplyr)spxtraits.matrix <- fish_traits %>%mutate(across(16:23, ~case_when(. =="P"~1, . =="A"~0, TRUE~as.numeric(.))),across(24, ~case_when(. =="A"~1, . =="B"~2, . =="C"~3, TRUE~as.numeric(.)))) %>%select(-c(gill_raker_types, oral_gape_axis)) %>%as.matrix()# Remove the "[,1]" suffix from column namesnames(spxtraits.matrix) <-gsub("[,1]", "", names(spxtraits.matrix))#check rownames#rownames(spxtraits.matrix) == rownames(spxcom.matrix)result_CWM <- FD::functcomp(spxtraits.matrix, t(spxcom.matrix)) #FD::functcomp(spxtraits.matrix, t(spxcom.matrix), CWM.type = "all")# Calculate Total biomasstotal_biomass <-colSums(spxcom.matrix)# Calculate Relative biomasssp_rel_biomass <-t(spxcom.matrix) / total_biomass# Transpose the Relative biomass Matrix for Displayt_sp_rel_biomass <-t(sp_rel_biomass)total_sum <-colSums(t(sp_rel_biomass))# Initialize an empty data frame to store resultsCWM_df <-data.frame(depth_layer =character(),trait =character(),total_sum =numeric(),weighted_mean =numeric(),stringsAsFactors =FALSE)# Loop through each traitfor (trait incolnames(spxtraits.matrix)) {# Calculate the weighted sum for the current trait weighted_sum <-colSums(t_sp_rel_biomass * spxtraits.matrix[, trait])# Create a data frame for the current trait trait_df <-data.frame(depth_layer =colnames(t_sp_rel_biomass),trait = trait,total_sum = total_sum,weighted_mean = weighted_sum )# Append results to the main data frame CWM_df <-rbind(CWM_df, trait_df)}CWM_df <- CWM_df %>%mutate(traits_names=gsub("_"," ", trait)) biomass <- t_sp_rel_biomass %>%as.data.frame() %>% tibble::rownames_to_column(var ="species") %>% tidyr::pivot_longer(!species, names_to ="depth_layer", values_to ="biomass") sd_values <- spxtraits.matrix %>%as.data.frame() %>% tibble::rownames_to_column(var ="species") %>% tidyr::pivot_longer(!species, names_to ="trait", values_to ="values") %>%inner_join(biomass) %>%filter(biomass>0) %>%group_by(trait, depth_layer) %>%mutate(SD=sd(values)) %>%select(SD, depth_layer, trait)CWM_df <- CWM_df %>%inner_join(sd_values)CWM_df <- CWM_df %>%filter(!trait%in%c("chin_barbel","dorsal_fin_insertion", "eye_position","gland_head", "oral_gape_position", "oral_gape_shape","pectoral_fin_position", "retractable_teeth","transversal_shape")) %>%mutate(traits_names=gsub("_"," ", trait)) CWM_df$depth_layer <-factor(CWM_df$depth_layer, levels =c("Epipelagic", "Upper mesopelagic","Lower mesopelagic", "Bathypelagic"))CWM_df$traits_names <-factor(CWM_df$traits_names, levels =c( "caudal throttle width", "oral gape surface","large teeth", "eye size","orbital length","small teeth","internal teeth", "lower jaw length","pectoral fin insertion", "fang teeth","operculum volume", "ventral photophores","gill outflow", "head length","body depth"))ggplot(CWM_df, aes(x = depth_layer, y = weighted_mean, group = depth_layer, color = depth_layer)) +geom_point(position =position_dodge(width =0.75), size =3) +facet_wrap(~traits_names, scales ="free", ncol =3) +scale_color_manual(values =c("#FEA520","#D62246","#6255B4","#3C685A"))+labs(x ="",y ="Community Weighted Mean ") +guides(col="none")+theme_light()+theme(axis.text.x =element_blank(), axis.title.x =element_blank(), axis.title.y.left =element_text(size =14), strip.text =element_text(size =12, face="bold"), legend.title =element_text(size =11), legend.text =element_text(size =11), axis.title.y =element_text(size=11),axis.text.y =element_text(size=12),strip.background=element_rect(fill="white"),strip.text.x =element_text(size =12, face ="bold", color ="black"))
## Summary of the assemblages * species data.frame ----asb_sp_fish_summ <- mFD::asb.sp.summary(asb_sp_w = depth_fish_biomass)asb_sp_fish_occ <- asb_sp_fish_summ$"asb_sp_occ"htmltools::tagList(DT::datatable(asb_sp_fish_occ))
2.2 Computing distances between species based on functional traits
We have non-continuous traits so we use the Gower distance(metric = “gower”) as this method allows traits weighting.
scale_euclid = TRUE
Code
sp_dist_fish <- mFD::funct.dist(sp_tr = fish_traits,tr_cat = fish_traits_cat,metric ="gower",scale_euclid ="scale_center",ordinal_var ="classic",weight_type ="equal",stop_if_NA =TRUE)## Output of the function mFD::funct.dist() ----#round(sp_dist_fish, 3)
2.3 Building functional spaces and chosing the best one
2.3.1 Computing several multimensional functional spaces and assessing their quality
mFD evaluates the quality of PCoA-based multidimensional spaces according to the deviation between trait-based distances and distances in the functional space (extension of Maire et al. (2015) framework).
This function generates a figure with three panels (in rows) for each selected functional space (in columns). Each column represents a functional space, the value of the quality metric is written on the top of each column. The x-axis of all panels represents trait-based distances. The y-axis is different for each row:
on the first (top) row, the y-axis represents species functional distances in the multidimensional space. Thus, the closer species are to the 1:1 line, the better distances in the functional space fit trait-based ones.
on the second row, the y-axis shows the raw deviation of species distances in the functional space compared to trait-based distances. Thus, the raw deviation reflects the distance to the horizontal line.
on the third row (bottom), the y-axis shows the absolute or squared deviation of the (“scaled”) distance in the functional space. It is the deviation that is taken into account for computing the quality metric.
2.3.3 Testing the correlation between functional axes and traits
Code
sp_faxes_coord_fish <- fspaces_quality_fish$"details_fspaces"$"sp_pc_coord"# As we have 26 traits we have to split the df to see correlation between functional axes and traits # first set ----fish_traits_1 <- fish_traits%>%select(1:9)fish_tr_faxes <- mFD::traits.faxes.cor(sp_tr = fish_traits_1, sp_faxes_coord = sp_faxes_coord_fish[ , c("PC1", "PC2", "PC3", "PC4")], plot = T)## Print traits with significant effect ----fish_tr_faxes$"tr_faxes_stat"[which(fish_tr_faxes$"tr_faxes_stat"$"p.value"<0.05), ]
trait axis test stat value p.value
1 eye_size PC1 Linear Model r2 0.169 0.0077
2 eye_size PC2 Linear Model r2 0.164 0.0087
3 eye_size PC3 Linear Model r2 0.119 0.0272
4 eye_size PC4 Linear Model r2 0.157 0.0104
5 orbital_length PC1 Linear Model r2 0.398 0.0000
6 orbital_length PC2 Linear Model r2 0.116 0.0290
10 gill_outflow PC2 Linear Model r2 0.510 0.0000
13 oral_gape_surface PC1 Linear Model r2 0.143 0.0147
14 oral_gape_surface PC2 Linear Model r2 0.504 0.0000
18 oral_gape_shape PC2 Linear Model r2 0.154 0.0111
24 oral_gape_position PC4 Linear Model r2 0.208 0.0027
26 lower_jaw_length PC2 Linear Model r2 0.692 0.0000
29 head_length PC1 Linear Model r2 0.314 0.0001
30 head_length PC2 Linear Model r2 0.400 0.0000
34 body_depth PC2 Linear Model r2 0.366 0.0000
35 body_depth PC3 Linear Model r2 0.190 0.0044
Code
## Plot ----fish_tr_faxes$"tr_faxes_plot"
Code
# second set ----fish_traits_2 <- fish_traits%>%select(10:18)fish_tr_faxes_2 <- mFD::traits.faxes.cor(sp_tr = fish_traits_2, sp_faxes_coord = sp_faxes_coord_fish[ , c("PC1", "PC2", "PC3", "PC4")], plot = T)## Print traits with significant effect ----fish_tr_faxes_2$"tr_faxes_stat"[which(fish_tr_faxes_2$"tr_faxes_stat"$"p.value"<0.05), ]
trait axis test stat value p.value
2 pectoral_fin_position PC2 Linear Model r2 0.260 0.0007
5 pectoral_fin_insertion PC1 Linear Model r2 0.273 0.0005
6 pectoral_fin_insertion PC2 Linear Model r2 0.410 0.0000
9 transversal_shape PC1 Linear Model r2 0.115 0.0304
11 transversal_shape PC3 Linear Model r2 0.223 0.0018
14 caudal_throttle_width PC2 Linear Model r2 0.403 0.0000
19 dorsal_fin_insertion PC3 Linear Model r2 0.175 0.0066
23 eye_position PC3 Linear Model r2 0.197 0.0037
26 operculum_volume PC2 Linear Model r2 0.109 0.0353
32 ventral_photophores PC4 Kruskal-Wallis eta2 0.597 0.0000
33 gland_head PC1 Kruskal-Wallis eta2 0.245 0.0011
Code
## Plot ----fish_tr_faxes_2$"tr_faxes_plot"
Code
# third set ----fish_traits_3 <- fish_traits%>%select(19:25)fish_tr_faxes_3 <- mFD::traits.faxes.cor(sp_tr = fish_traits_3, sp_faxes_coord = sp_faxes_coord_fish[ , c("PC1", "PC2", "PC3", "PC4")], plot = T)## Print traits with significant effect ----fish_tr_faxes_3$"tr_faxes_stat"[which(fish_tr_faxes_3$"tr_faxes_stat"$"p.value"<0.05), ]
a data.frame gathering indices values in each assemblage (for FIde values, there are as many columns as there are axes to the studied functional space).
a details list of data.frames and lists gathering information such as coordinates of centroids, distances and identity of the nearest neighbour, distances to the centroid, etc. The user does not have to directly use it but it will be useful if FD indices are then plotted. It can be retrieved through:
the proportion of functional space filled by species of the studied assemblage, i.e. the volume inside the convex-hull shaping species. To compute FRic the number of species must be at least higher than the number of functional axis + 1.
Code
## Compute the range of functional axes:range_sp_coord <-range(sp_faxes_coord_fish)## Based on the range of species coordinates values, compute a nice range ...## ... for functional axes:range_faxes <- range_sp_coord +c(-1, 1) * (range_sp_coord[2] - range_sp_coord[1]) *0.05####### Create a list that will contains plots for each combination of axis:plot_FRic <-list()####### Compute all the combiantion we can get and the number of plotsaxes_plot <- utils::combn(c("PC1", "PC2", "PC3", "PC4"), 2)plot_nb <-ncol(axes_plot)######## Loop on all pairs of axes:# for each combinaison of two axis:for (k in (1:plot_nb)) {# get names of axes to plot: xy_k <- axes_plot[1:2, k]####### Steps previously showed# a - Background:# get species coordinates along the two studied axes: sp_faxes_coord_xy <- sp_faxes_coord_fish[, xy_k]# Plot background with grey backrgound: plot_k <- mFD::background.plot(range_faxes = range_faxes, faxes_nm =c(xy_k[1], xy_k[2]),color_bg ="grey95")# b - Global convex-hull:# Retrieve vertices coordinates along the two studied functional axes: vert <- mFD::vertices(sp_faxes_coord = sp_faxes_coord_xy, order_2D =FALSE, check_input =TRUE) plot_k <- mFD::pool.plot(ggplot_bg = plot_k,sp_coord2D = sp_faxes_coord_xy,vertices_nD = vert,plot_pool =FALSE,color_pool =NA,fill_pool =NA,alpha_ch =0.8,color_ch ="white",fill_ch ="white",shape_pool =NA,size_pool =NA,shape_vert =NA,size_vert =NA,color_vert =NA,fill_vert =NA)# c - Assemblages convex-hulls and species:# Step 1: Species coordinates:# Bathypelagic:## filter species from Bathypelagic: sp_filter_Bathypelagic <- mFD::sp.filter(asb_nm =c("Bathypelagic"),sp_faxes_coord = sp_faxes_coord_xy,asb_sp_w = depth_fish_biomass)## get species coordinates (Bathypelagic): sp_faxes_coord_Bathypelagic <- sp_filter_Bathypelagic$`species coordinates`# Lower mesopelagic:## filter species from Lower mesopelagic: sp_filter_Lower_mesopelagic <- mFD::sp.filter(asb_nm =c("Lower mesopelagic"),sp_faxes_coord = sp_faxes_coord_xy,asb_sp_w = depth_fish_biomass)## get species coordinates (Lower mesopelagic): sp_faxes_coord_Lower_mesopelagic <- sp_filter_Lower_mesopelagic$`species coordinates`# Upper mesopelagic:## filter species from Upper mesopelagic: sp_filter_Upper_mesopelagic <- mFD::sp.filter(asb_nm =c("Upper mesopelagic"),sp_faxes_coord = sp_faxes_coord_xy,asb_sp_w = depth_fish_biomass)## get species coordinates (Upper mesopelagic): sp_faxes_coord_Upper_mesopelagic <- sp_filter_Upper_mesopelagic$`species coordinates`# Epipelagic:## filter species from Epipelagic: sp_filter_Epipelagic <- mFD::sp.filter(asb_nm =c("Epipelagic"),sp_faxes_coord = sp_faxes_coord_xy,asb_sp_w = depth_fish_biomass)## get species coordinates (Epipelagic): sp_faxes_coord_Epipelagic <- sp_filter_Epipelagic$`species coordinates`# Step 1 follow-up Vertices names:# Bathypelagic: vert_nm_Bathypelagic <- mFD::vertices(sp_faxes_coord = sp_faxes_coord_Bathypelagic,order_2D =TRUE, check_input =TRUE)# Lower mesopelagic: vert_nm_Lower_mesopelagic <- mFD::vertices(sp_faxes_coord = sp_faxes_coord_Lower_mesopelagic,order_2D =TRUE, check_input =TRUE)# Upper mesopelagic: vert_nm_Upper_mesopelagic <- mFD::vertices(sp_faxes_coord = sp_faxes_coord_Upper_mesopelagic,order_2D =TRUE, check_input =TRUE)# Epipelagic: vert_nm_Epipelagic <- mFD::vertices(sp_faxes_coord = sp_faxes_coord_Epipelagic,order_2D =TRUE, check_input =TRUE)# Step 2: plot convex-hulls and species of studied assemblages: plot_k <- mFD::fric.plot(ggplot_bg = plot_k,asb_sp_coord2D =list("Bathypelagic"= sp_faxes_coord_Bathypelagic,"Lower mesopelagic"= sp_faxes_coord_Lower_mesopelagic,"Upper mesopelagic"= sp_faxes_coord_Upper_mesopelagic,"Epipelagic"= sp_faxes_coord_Epipelagic),asb_vertices_nD =list("Bathypelagic"= vert_nm_Bathypelagic,"Lower mesopelagic"= vert_nm_Lower_mesopelagic,"Upper mesopelagic"= vert_nm_Upper_mesopelagic,"Epipelagic"= vert_nm_Epipelagic),plot_sp = T,color_ch =c("Bathypelagic"="#3C685A","Lower mesopelagic"="#6255B4","Upper mesopelagic"="#D62246","Epipelagic"="#FEA520"),fill_ch =c("Bathypelagic"="#3C685A","Lower mesopelagic"="#6255B4","Upper mesopelagic"="#D62246","Epipelagic"="#FEA520"),alpha_ch =c("Bathypelagic"=0.2,"Lower mesopelagic"=0.2,"Upper mesopelagic"=0.2,"Epipelagic"=0.2),shape_sp =c("Bathypelagic"=20,"Lower mesopelagic"=20,"Upper mesopelagic"=20,"Epipelagic"=20),size_sp =c("Bathypelagic"=0.4,"Lower mesopelagic"=0.4,"Upper mesopelagic"=0.4,"Epipelagic"=0.4),color_sp =c("Bathypelagic"="#3C685A","Lower mesopelagic"="#6255B4","Upper mesopelagic"="#D62246","Epipelagic"="#FEA520"),fill_sp =c("Bathypelagic"="white","Lower mesopelagic"="#6255B4","Upper mesopelagic"="#D62246","Epipelagic"="#FEA520"),shape_vert =c("Bathypelagic"=17,"Lower mesopelagic"=17,"Upper mesopelagic"=17,"Epipelagic"=17),size_vert =c("Bathypelagic"=4,"Lower mesopelagic"=4,"Upper mesopelagic"=4,"Epipelagic"=4),color_vert =c("Bathypelagic"="#3C685A","Lower mesopelagic"="#6255B4","Upper mesopelagic"="#D62246","Epipelagic"="#FEA520"),fill_vert =c("Bathypelagic"="white","Lower mesopelagic"="#6255B4","Upper mesopelagic"="#D62246","Epipelagic"="#FEA520"))####### Save the plot on the plot list: plot_FRic[[k]] <- plot_k}#plot_FRicpatchwork_FRic <- (plot_FRic[[1]] + patchwork::plot_spacer() + patchwork::plot_spacer() + plot_FRic[[2]] + plot_FRic[[4]] + patchwork::plot_spacer() + plot_FRic[[3]] + plot_FRic[[5]] + plot_FRic[[6]]) + patchwork::plot_layout(byrow =TRUE, heights =rep(1, 3),widths =rep(1, 3), ncol =3, nrow =3,guides ="collect")patchwork_FRic
the proportion of the biomass supported by the species with the most extreme functional traits i.e. the ones located close to the edge of the convex-hull filled by the assemblage
Code
plots_alpha$"fdiv"$"patchwork"
FEve Functional Evenness
the regularity of biomass distribution in the functional space using the Minimum Spanning Tree linking all species present in the assemblage.
Code
plots_alpha$"feve"$"patchwork"
FSpe Functional Specialization
the biomass weighted mean distance to the mean position of species from the global pool (present in all assemblages).
Code
plots_alpha$"fspe"$"patchwork"
FDis Functional Dispersion
the biomass weighted deviation of species traits values from the center of the functional space filled by the assemblage i.e. the biomass-weighted mean distance to the biomass-weighted mean trait values of the assemblage.
Code
plots_alpha$"fdis"$"patchwork"
FIde Functional Identity
the mean traits values for the assemblage. FIde is always computed when FDis is computed.
Code
plots_alpha$"fide"$"patchwork"
3.2.Computing and plotting beta FD indices
The function returns a list containing:
a dist object with beta indices values for each pair of assemblages:
Functional distinctiveness is the mean of dissimilarity of the focal species to all the other species of the set of interest. It can be abundance-weighted if needed.
Functional uniqueness is the smallest dissimilarity that exists between the focal species and the all other species in the set. It does not consider the abundance of any species.
Rarity indices:
Scarcity is proportional to the relative abundance of the species. It gets close to one when the species is (relatively) rare and close to 0 when its dominant
Restrictedness is 1 minus the ratio of sites a species occupy over the total number of sites.
4.2.Computing functional rarity
4.2.1 Functional originality at regional scale
For the choice or dissimilarity matrix we can use the raw dissimilarity matrix computed directly on raw traits values among species:
To compute uniqueness at regional scale we also need the regional level functional dissimilarity matrix with the uniqueness() function, and the site-species matrix:
Code
sp_ui <- funrar::uniqueness(pres_matrix = depth_fish_biomass,as.matrix(sp_dist_fish))quantile(sp_ui$Ui, probs =seq(0, 1, by =0.1))
Based on these results we see that Anoplogaster cornuta, and Malacosteus niger are the most isolated fish in the functional space. Meaning that they have the most distant nearest neighbors.
As we had to manually build the function to compute the local uniqueness the results are strangely formatted.
We provide here a function that can help them to be more easily read:
Code
depth_ui <-lapply(names(depth_ui), function(x) { single_depth = depth_ui[[x]] single_depth$site = xreturn(single_depth)})depth_ui <-do.call(rbind, depth_ui)#Then we can again look at the apple to see how its uniqueness varies across depths.subset(depth_ui, species =="Melanostomias_bartonbeani")
Anoplogaster_cornuta Arctozenus_risso Argyropelecus_hemigymnus
Min. :0.9457 Min. :0.2087 Min. :0.9614
1st Qu.:0.9457 1st Qu.:0.2275 1st Qu.:0.9834
Median :0.9457 Median :0.3691 Median :0.9920
Mean :0.9457 Mean :0.3698 Mean :0.9848
3rd Qu.:0.9457 3rd Qu.:0.5114 3rd Qu.:0.9935
Max. :0.9457 Max. :0.5322 Max. :0.9937
NA's :3
Argyropelecus_olfersii Bathylagus_euryops Benthosema_glaciale
Min. :0.1540 Min. :0.2375 Min. :0.1350
1st Qu.:0.4510 1st Qu.:0.2375 1st Qu.:0.1354
Median :0.5727 Median :0.2375 Median :0.3725
Mean :0.5191 Mean :0.2375 Mean :0.4461
3rd Qu.:0.6407 3rd Qu.:0.2375 3rd Qu.:0.6831
Max. :0.7769 Max. :0.2375 Max. :0.9043
NA's :3
Bolinichthys_supralateralis Borostomias_antarcticus Ceratoscopelus_maderensis
Min. :0.9178 Min. :0.7669 Min. :0.2463
1st Qu.:0.9324 1st Qu.:0.9253 1st Qu.:0.3191
Median :0.9469 Median :0.9848 Median :0.5243
Mean :0.9469 Mean :0.9324 Mean :0.5049
3rd Qu.:0.9615 3rd Qu.:0.9919 3rd Qu.:0.7101
Max. :0.9761 Max. :0.9933 Max. :0.7249
NA's :2
Chauliodus_sloani Cyclothone_sp Derichthys_serpentinus
Min. :0.6046 Min. :0.4436 Min. :0.9520
1st Qu.:0.8168 1st Qu.:0.6248 1st Qu.:0.9642
Median :0.9366 Median :0.8050 Median :0.9765
Mean :0.8675 Mean :0.7517 Mean :0.9723
3rd Qu.:0.9873 3rd Qu.:0.9319 3rd Qu.:0.9825
Max. :0.9922 Max. :0.9531 Max. :0.9886
NA's :1
Diaphus_metopoclampus Evermannella_balbo Gonostoma_elongatum
Min. :0.9914 Min. :0.8253 Min. :0.8600
1st Qu.:0.9924 1st Qu.:0.9036 1st Qu.:0.8803
Median :0.9935 Median :0.9819 Median :0.9005
Mean :0.9935 Mean :0.9331 Mean :0.9005
3rd Qu.:0.9946 3rd Qu.:0.9870 3rd Qu.:0.9207
Max. :0.9956 Max. :0.9921 Max. :0.9410
NA's :2 NA's :1 NA's :2
Holtbyrnia_anomala Holtbyrnia_macrops Lampanyctus_crocodilus
Min. :0.8992 Min. :0.9760 Min. :0.002336
1st Qu.:0.8992 1st Qu.:0.9793 1st Qu.:0.002818
Median :0.8992 Median :0.9825 Median :0.023718
Mean :0.8992 Mean :0.9821 Mean :0.063779
3rd Qu.:0.8992 3rd Qu.:0.9851 3rd Qu.:0.084679
Max. :0.8992 Max. :0.9877 Max. :0.205344
NA's :3 NA's :1
Lampanyctus_macdonaldi Lestidiops_sphyrenoides Lobianchia_gemellarii
Min. :0.3152 Min. :0.8648 Min. :0.7595
1st Qu.:0.3152 1st Qu.:0.9159 1st Qu.:0.8752
Median :0.3152 Median :0.9619 Median :0.9206
Mean :0.3152 Mean :0.9456 Mean :0.8888
3rd Qu.:0.3152 3rd Qu.:0.9915 3rd Qu.:0.9342
Max. :0.3152 Max. :0.9938 Max. :0.9545
NA's :3
Malacosteus_niger Maulisia_argipalla Maulisia_mauli Maulisia_microlepis
Min. :0.7700 Min. :0.9069 Min. :0.5091 Min. :0.6294
1st Qu.:0.8196 1st Qu.:0.9137 1st Qu.:0.7397 1st Qu.:0.6294
Median :0.8692 Median :0.9205 Median :0.9704 Median :0.6294
Mean :0.8692 Mean :0.9205 Mean :0.8252 Mean :0.6294
3rd Qu.:0.9187 3rd Qu.:0.9273 3rd Qu.:0.9833 3rd Qu.:0.6294
Max. :0.9683 Max. :0.9341 Max. :0.9962 Max. :0.6294
NA's :2 NA's :2 NA's :1 NA's :3
Maurolicus_muelleri Melanostigma_atlanticum Melanostomias_bartonbeani
Min. :0.2003 Min. :0.8997 Min. :0.8808
1st Qu.:0.2248 1st Qu.:0.9244 1st Qu.:0.8846
Median :0.5189 Median :0.9564 Median :0.8975
Mean :0.5346 Mean :0.9494 Mean :0.9100
3rd Qu.:0.8286 3rd Qu.:0.9814 3rd Qu.:0.9229
Max. :0.9004 Max. :0.9851 Max. :0.9643
Myctophum_punctatum Lampanyctus_ater Normichthys_operosus Notoscopelus_kroyeri
Min. :0.03938 Min. :0.4168 Min. :0.05115 Min. :0.1010
1st Qu.:0.37694 1st Qu.:0.6576 1st Qu.:0.05115 1st Qu.:0.1913
Median :0.49498 Median :0.8515 Median :0.05115 Median :0.2623
Mean :0.40978 Mean :0.7750 Mean :0.05115 Mean :0.2615
3rd Qu.:0.52782 3rd Qu.:0.9689 3rd Qu.:0.05115 3rd Qu.:0.3325
Max. :0.60979 Max. :0.9802 Max. :0.05115 Max. :0.4204
NA's :3
Paralepis_coregonoides Photostylus_pycnopterus Sagamichthys_schnakenbecki
Min. :0.9798 Min. :0.9662 Min. :0.9280
1st Qu.:0.9850 1st Qu.:0.9662 1st Qu.:0.9528
Median :0.9878 Median :0.9662 Median :0.9776
Mean :0.9885 Mean :0.9662 Mean :0.9633
3rd Qu.:0.9913 3rd Qu.:0.9662 3rd Qu.:0.9809
Max. :0.9986 Max. :0.9662 Max. :0.9842
NA's :3 NA's :1
Searsia_koefoedi Serrivomer_beanii Sigmops_bathyphilus Stomias_boa
Min. :0.4905 Min. :0.05996 Min. :0.8818 Min. :0.1705
1st Qu.:0.5832 1st Qu.:0.31697 1st Qu.:0.9080 1st Qu.:0.1949
Median :0.6823 Median :0.44517 Median :0.9343 Median :0.2059
Mean :0.6822 Mean :0.40779 Mean :0.9343 Mean :0.2278
3rd Qu.:0.7813 3rd Qu.:0.53599 3rd Qu.:0.9605 3rd Qu.:0.2389
Max. :0.8737 Max. :0.68088 Max. :0.9867 Max. :0.3289
NA's :2
Xenodermichthys_copei Notoscopelus_bolini
Min. :0.001095 Min. :0.3286
1st Qu.:0.008619 1st Qu.:0.6470
Median :0.115780 Median :0.9653
Mean :0.191149 Mean :0.7554
3rd Qu.:0.298310 3rd Qu.:0.9688
Max. :0.531940 Max. :0.9723
NA's :1
restrictiveness:
Code
ri = funrar::restrictedness(depth_fish_biomass)summary(ri)
species Ri
Length:41 Min. :0.0000
Class :character 1st Qu.:0.0000
Mode :character Median :0.0000
Mean :0.2378
3rd Qu.:0.5000
Max. :0.7500
4.3 Plotting functional rarity
4.3.1 Plotting functional originality
option to be able to colour species according to their functional originality (and not use the ready-made functions in the mfd package)
As was done with mFD to correlate the functional axes with species’ traits we can correlate functional distinctiveness to specific traits in order to see which traits are mainly driving distinctiveness.
Regarding local level functional originality indices, the visualization can be more difficult to grasp and depends highly on the question. Would you rather focus on visualizing the functional distinctiveness of one species across communities? Compare the distribution of functional distinctiveness values across communities?
One idea to keep in mind is that averaging functional distinctiveness per community is exactly equal to computing functional dispersion. Functional originality is computed on a species basis, so we should be aware that if we are rather interested by community properties than we can compute functional diversity metrics which are much more appropriate.
depth_biomass <-rbind(data_biomass_2002_2019, data_biomass_2021, data_biomass_2022)%>%as.data.frame()%>%rename("species"="Nom_Scientifique","station"="Code_Station") %>%left_join(metadata) %>%select(species, Tot_V_HV, depth, volume_filtered)%>%# divise biomass by the volume filtered at each trawl (g.m3)mutate(biomass_cpu=(Tot_V_HV/volume_filtered)*1000)%>%select(species, depth, biomass_cpu)%>%group_by(species, depth)%>%mutate(biomass=sum(biomass_cpu))%>%select(-c(biomass_cpu))%>%distinct() %>%mutate(species =case_when( species =="Nannobrachium_atrum"~"Lampanyctus_ater", species =="Cyclothone"~"Cyclothone_sp", species =="Stomias_boa_boa"~"Stomias_boa",TRUE~ species ))